package main

import (
	"gin-study/docs"
	routers "gin-study/routers"
	"github.com/gin-gonic/gin"
	"net/http"
)

func main() {
	// 1.创建路由
	// 默认使用了2个中间件Logger(), Recovery()
	r := routers.InitRouter()
	// 路由组
	v1 := r.Group("/group")
	{
		v1.GET("/login", login)
		v1.POST("submit", submit)
	}
	docs.SwaggerInfo.BasePath = "/api/"
	r.Run(":9080")
}

func submit(context *gin.Context) {
	context.JSON(http.StatusOK, gin.H{"res": "submit"})
}

func login(context *gin.Context) {
	context.JSON(http.StatusOK, gin.H{"res": "login"})
}
